﻿using System.Collections.ObjectModel;

namespace Central.Linq.MvcJson.Engine {

	public class JsonSortManager {

		public JsonSortManager() {
			this.SortParams = new Collection<SortParam>();
		}

		public Collection<SortParam> SortParams { get; set; }

		internal SortManager CreateSortManager {
			get {
				if (this.SortParams != null && this.SortParams.Count > 0) {
					SortManager result = new SortManager();
					foreach (SortParam item in this.SortParams) {
						result.Add(new SortDefinition() { Name = item.Name, Value = item.Value });
					}
					return result;
				}
				else {
					return null;
				}
			}
		}
	}
}